Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

event-emitter

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

event-emitter

Environment agnostic event emitter

  • 0.3.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.6M
decreased by-4.81%
Maintainers
1
Weekly downloads
 
Created

What is event-emitter?

The event-emitter npm package is a lightweight and flexible library for managing events in JavaScript. It allows you to create, listen to, and emit events, making it easier to handle asynchronous operations and decouple different parts of your application.

What are event-emitter's main functionalities?

Creating an Event Emitter

This feature allows you to create a new event emitter instance. The instance can be used to manage events within your application.

const EventEmitter = require('event-emitter');
const emitter = EventEmitter();

Listening to Events

This feature allows you to listen for specific events. When the event is emitted, the provided callback function is executed.

emitter.on('event', function(data) {
  console.log('Event received:', data);
});

Emitting Events

This feature allows you to emit events. When an event is emitted, all listeners for that event are called with the provided data.

emitter.emit('event', { key: 'value' });

Removing Event Listeners

This feature allows you to remove specific event listeners. This is useful for cleaning up and preventing memory leaks.

const callback = function(data) {
  console.log('Event received:', data);
};
emitter.on('event', callback);
emitter.off('event', callback);

Other packages similar to event-emitter

Keywords

FAQs

Package last updated on 15 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc